package mh.entity.object;

import mh.map.render.RenderItem;

/**
 * The representation of each object in the map, an object is something that is map related and its creation is
 * controlled only by map's creator.
 * 
 * @author Gianmarco Laggia
 * @author Alberto D'Este
 * 
 */
public class EntityItem extends EntityObject {

	public EntityItem(RenderItem r, int damageThreshold, int maximumHealth, int weight, double reflection, boolean collectable) {
		super(damageThreshold, maximumHealth, weight, EnumEntityObjectSize.SHORT, true, reflection, true, collectable); //an object when created can always move.
		this.render = r;
	}

	/**
	 * Copy constructor.
	 * 
	 * @param e
	 *            The entity to clone
	 */
	public EntityItem(EntityItem e) {
		super(e.damageThreshold, e.maximumHealth, e.weight, EnumEntityObjectSize.SHORT, true, e.reflection, true, e.collectable);
		this.render = new RenderItem((RenderItem) e.render, this);
	}

	/**
	 * An EntityItem is always walkable for definition. This method will always return true.
	 */
	@Override
	public boolean isWalkable() {
		return true;
	}

	@Override
	public void draw(long delta, boolean foreground) {
		this.render.draw(delta, ((this.actualX + CENTRAL_COLUMN) - this.playerX) * 32, ((this.actualY + CENTRAL_ROW) - this.playerY) * 32, foreground);
	}

	@Override
	protected void setAttributes() {

	}

}
